from google.appengine.ext import db
from google.appengine.ext.db import polymodel
from Utility import UserRole
from Common.Validator import Validator

class Profile(polymodel.PolyModel,Validator):
    UserName = db.StringProperty(required=True)
    Password = db.StringProperty(required=True)
    DisplayName = db.StringProperty(required=True)
    Email = db.EmailProperty(required=True)
    Role = db.StringProperty(required=True, 
                             default=UserRole.User,
                             choices=set([UserRole.SystemAdmin, 
                                      UserRole.CompanyAdmin, 
                                      UserRole.GroupAdmin, 
                                      UserRole.User]))
    _rules = {
        'Email' : [Validator.email]
    }